<template>
  <el-menu
      :style="{width: isCollapse? '64px': '210px'}"
      active-text-color="#ffd04b"
      background-color="#545c64"
      class="aside-container"
      :default-active="active"
      text-color="#fff"
      @open="handleOpen"
      @close="handleClose"
      :collapse="isCollapse"
  >
    <p class="logo-lg">{{ isCollapse ? 'DIDI' : 'DIDI陪诊' }}</p>
    <TreeMenu :index="1" :menuData="menuData"/>
  </el-menu>
</template>

<script setup>
import TreeMenu from "./treeMenu.vue";
import {useRouter} from 'vue-router'
import {computed} from 'vue'
import {useStore} from 'vuex'

const store = useStore()
const isCollapse = computed(() => store.state.menu.isCollapse)

const router = useRouter()
//const menuData = reactive(router.options.routes[0].children)
//上面注释掉 通过vuex中获取动态路由
const menuData = computed(() => store.state.menu.routerList)
//按照路由 默认选中的菜单
const active = computed(() => store.state.menu.menuActive)
console.log(active,'active')
/*console.log(menuData, 'aside-menuData')*/
const handleOpen = () => {
}
const handleClose = () => {
}

</script>
<style lang="less" scoped>
.aside-container {
  height: 100vh;

  .logo-lg {
    font-size: 20px;
    text-align: center;
    height: 50px;
    line-height: 50px;
    color: #fff;
  }
}

</style>
